<template>
  <el-drawer direction="rtl" v-model="dialogVisible" :title="dialogTitle" size="70%">
    <ContentWrap>
      <!-- 搜索工作栏 -->

      <el-form :model="formData" label-width="120px">
        <el-form-item label="配置描述">
          {{ formData.configRemark }}
        </el-form-item>
        <el-form-item label="开户姓名" prop="memberUserName">
          {{ formData.memberUserName }}
        </el-form-item>
        <!-- <el-form-item label="手续费" prop="payFeeStyle">
          <span v-for="(dict, idx) in elecPayFeeStyleDictDatas" :key="idx">
            <label v-if="parseInt(dict.value) == formData.payFeeStyle">{{ dict.label }}</label>
          </span>
        </el-form-item> -->
        <el-alert
          title="转账绑定，T+1工作日侯自动转入到银行账户"
          type="success"
          :closable="false"
          style="margin-bottom: 10px"
        />
        <el-form-item label="商户编号" prop="matCode">
          {{ formData.matCode }}
        </el-form-item>
        <el-form-item label="商户有效期" prop="matExpiresTime">
          {{ formatDate(formData.matExpiresTime, 'YYYY-MM-DD') }}
        </el-form-item>
        <el-alert
          title="电费充值设置"
          type="success"
          :closable="false"
          style="margin-bottom: 10px"
        />
        <el-form-item label="平台手续费" prop="platformElecChargeRate">
          {{ formData.platformElecChargeRate }}%
          <span style="margin-left: 20px; color: red">电费充值时平台抽取的手续费（比如0.35%），银联手续费另外收取</span>
        </el-form-item>
        <el-form-item label="提醒设置" prop="warnElecMoney">
          {{ divide(formData.warnElecMoney, 100) }}元
          <span style="margin-left: 20px; color: red">当电表余额小于该值时消息提醒</span>
        </el-form-item>
        <el-form-item label="最少充值" prop="minPayElecCharge">
          {{ divide(formData.minPayElecCharge, 100) }}元
          <span style="margin-left: 20px; color: red">房东名下所有电表充值最低限额</span>
        </el-form-item>
        <el-alert
          title="宽带充值设置"
          type="success"
          :closable="false"
          style="margin-bottom: 10px"
        />
        <el-form-item label="平台手续费" prop="platformNetPayRate">
          {{ formData.platformNetPayRate }}%
          <span style="margin-left: 20px; color: red">宽带充值时平台抽取的手续费（比如0.35%），银联手续费另外收取</span>
        </el-form-item>
        <el-alert
          title="房租收租设置"
          type="success"
          :closable="false"
          style="margin-bottom: 10px"
        />
        <el-form-item label="平台手续费" prop="platformRentBillPayRate">
          {{ formData.platformRentBillPayRate }}%
          <span style="margin-left: 20px; color: red">用户支付房租时平台抽取的手续费（比如0.35%），银联手续费另外收取</span>
        </el-form-item>
      </el-form>
    </ContentWrap>
  </el-drawer>
</template>
<script lang="ts" setup>
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { formatDate } from '@/utils/formatTime'
import { divide } from '@/utils/tools'
import * as OwnMeterConfigApi from '@/api/zwsj/ownMeterConfig'

defineOptions({ name: 'OwnMeterConfigView' })

const dialogVisible = ref(false) // 弹窗的是否展示
const dialogTitle = ref('') // 弹窗的标题

const formData: any = ref({
  id: undefined,
  memberUserId: undefined,
  memberUserName: undefined,
  payFeeStyle: undefined,
  matCode: undefined,
  platformElecChargeRate: undefined,
  platformNetPayRate: undefined,
  platformRentBillPayRate: undefined,
  warnElecMoney: undefined,
  lastOperIp: undefined,
  lastOperDate: undefined,
  matExpiresTime: undefined,
  minPayElecCharge: undefined
})

const elecPayFeeStyleDictDatas = getIntDictOptions(DICT_TYPE.ELEC_PAY_FEE_STYLE)

/** 打开弹窗 */
const open = async (configId: number) => {
  dialogVisible.value = true
  dialogTitle.value = '银联账户信息'
  formData.value = await OwnMeterConfigApi.getOwnMeterConfig(configId)
}
defineExpose({ open }) // 提供 open 方法，用于打开弹窗

/** 初始化 **/
onMounted(async () => {
  //await getList()
})
</script>
